//
// Scene.h
//

#include "Common.h"
using namespace std;

class Scene
{
public:
    void Load(const std::string &databaseDirectory, const std::string &sceneShortFilename);
	//void AssignTestData(map<int, vector<string> > testData);
	void UpdateCamera();
	Camera GetCamera();
	void TargetCamera(int modelNumber);
	string GetSceneName();

    void KeyPress(unsigned char key, string screenshotName);
    void MouseDown(int button, int x, int y);
    void MouseMove(int x, int y);
    void ReSize(int windowWidth, int windowHeight);
    void Update(float seconds);
    void Render();

	// ++TODO: this should cause Scene to remove the model assets of the replacement model, and replace them
	// with the assets of the new model (resizing the new model to the same bounding box as the old)
	//void ReplaceModel(int originalModelIndex, string replacementModelId, string databaseDir, 
	//	Vec3f oBoxMin, Vec3f oBoxMax);
	//void ReplaceModel(int originalModelIndex, string modelId_Replacement, string databaseDir, 
	//	const Vec3f& originalBBoxMin, const Vec3f& originalBBoxMax);
	ModelInstance* GetModelPointer(int modelIndex);
	vector<ModelInstance*> GetAllModels();
	int GetNumModelsInScene();

private:
	void ResetCamera(const Vec3f &roomCenter, const Vec3f &targetModel);
	Vec3f GetRoomCenterInWorldCoords();
	Vec3f GetModelCenterInWorldCoords(int modelNumber);
	void SimpleScreenshot(const std::string &outputFile);
	//float Scene::FindBestScalingFactor(Vec3f& oBoxMin, Vec3f& oBoxMax, ModelInstance* newModelInstance);

	string _sceneName;

	// The models in the scene
    vector<ModelInstance*> _allModels;

    Assets _assets;
    Camera _camera;

    int _mouseButton, _mouseX, _mouseY;
    int _windowWidth, _windowHeight;
};
